package com.guoxue.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.guoxue.dao.ILevelConfigDao;
import com.guoxue.domain.LevelConfigVo;
@Repository
public class LevelConfigDaoImpl extends BaseDaoImpl<LevelConfigVo> implements ILevelConfigDao{

	@Override
	public LevelConfigVo getLevelByExp(int exp) {
		List<LevelConfigVo> list = find("FROM LevelConfigVo l WHERE l.exp<=? AND l.sysflag=0 ORDER BY l.level DESC", new Object[]{exp});
		return list.get(0);
	}

	@Override
	public LevelConfigVo getNextLevelByExp(int exp) {
		List<LevelConfigVo> list = find("FROM LevelConfigVo l WHERE l.exp>? AND l.sysflag=0 ORDER BY l.level ASC",new Object[]{exp});
		return list.get(0);
	}

}
